<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>APP</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../font/iconfont.css" />
    <script src="../font/iconfont.js"></script>
    <style>
    .icon {
      width: 1.5em;
      height: 1.5em;
      vertical-align: -0.3rem;
      fill: currentColor;
      overflow: hidden;
      margin-left: 0.6rem;
      margin-right: 1rem;
    }
    .icon1{
      width: 2em;
      height: 2em;
      vertical-align: -0.3rem;
      fill: currentColor;
      overflow: hidden;
    }
    .icon2{
      width: 1.8em;
      height: 1.8em;
      vertical-align: -0.3rem;
      fill: currentColor;
      overflow: hidden;

    }
    </style>

</head>
<style>
.clearfloat:after{display:block;clear:both;content:"";visibility:hidden;height:0}
.clearfloat{zoom:1}
    .header-1 {

        background: url('./img/person/bg.png') no-repeat;
        background-size: cover;
        padding: 2.5rem 1rem;
    }

  .header-img {
        width: 4.6rem;
        height: 4.6rem;
        border-radius: 50%;

        float: left;
        overflow: hidden;
    }

   .header-counter {
        width: 10rem;
        height: 5rem;
        float: left;
        padding: 1rem;
    }

   .header-set {
        width: 1.8rem;
        height: 1.8rem;
        border-radius: 50%;
        background: url('./img/person/set.png') no-repeat;
        float: right;
        background-size: cover;
    }


</style>

<body>


    <div class="content" style="padding-bottom:0">
        <div id="interpolation">


        </div>
    </div>
</body>
<script id="interpolationtmpl" type="text/x-dot-template">

<div class="aui-content">
          <div class="aui-row header-1">
              <div class="aui-col-xs-4">
                <div class="header-img " onclick="fnOpenWinCommon(this,{phone:{{? it.head_img}}'{{=it.head_img}}'{{??}}''{{?}}})" data-url="my_name">
                <img src="{{? it.head_img}}{{=it.head_img}}{{??}}./img/user.jpg{{?}}" alt="" title="" style="width:100%"></div>
              </div>
              <div class="aui-col-xs-5" style="text-align:left;padding-top:1.4rem;">
                <h2 style="color:#fff;">{{=it.nickname}}</h2>
                <h2 style="color:#fff;font-size:0.8rem">{{=it.phone}}</h2>
              </div>
              <div class="aui-col-xs-2" style="padding-top:0.6rem;text-align:center" onclick="fnOpenWinCommon(this)" data-url="my_home" >
                <svg class="icon1" aria-hidden="true">
<use xlink:href="#iconsk-shezhi"></use>
</svg>
              </div>
              <div class="aui-col-xs-1" style="padding-top:0.6rem;"  onclick="fnOpenWinCommon(this)" data-url="my_msg">
                <svg class="icon2" aria-hidden="true">
<use xlink:href="#iconsk-xiaoxi-copy"></use>
</svg>
              </div>

          </div>
      </div>
<div style="height:2.6rem;padding-left:1rem;font-size:0.9rem;line-height:2.6rem;">账户明细</div>
<div class=".aui-content" style="border-bottom:1px solid #ccc;border-top:1px solid #ccc;padding:0.6rem 0">
        <div class="aui-row">
            <div class="aui-col-xs-6" style="text-align:center;">
              <h2 style="color:#ff4285;">{{=it.money}}元</h2>
              <p>账户余额</p>
            </div>
            <div class="aui-col-xs-6" style="text-align:center;">
              <h2 style="color:#ff4285">{{=it.point}}分</h2>
              <p>积分</p>
            </div>

        </div>
    </div>


    <ul class="aui-list aui-list-in" style="margin-top:0.6rem">
        <li class="aui-list-item" onclick="fnOpenWin1(this)" data-name="task_ing">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title"><svg class="icon" aria-hidden="true">
<use xlink:href="#iconsk-shijian"></use>
</svg>我的所有试用</div>
                <div class="aui-list-item-right">
                    查看全部任务
                </div>
            </div>
        </li>
    </ul>
    <ul class="aui-list aui-list-in" style="margin:0.5rem 0;">
        <li class="aui-list-item" onclick="fnOpenWin(this)" data-name="deposit">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title"><svg class="icon" aria-hidden="true">
<use xlink:href="#iconsk-balance"></use>
</svg>余额提现</div>
                <div class="aui-list-item-right">
                    点击提现
                </div>
            </div>
        </li>
        <li class="aui-list-item" onclick="fnOpenWin(this)" data-name="depoist_log">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title"><svg class="icon" aria-hidden="true">
<use xlink:href="#iconsk-tixian"></use>
</svg>提现记录</div>
                <div class="aui-list-item-right">
                    点击查看
                </div>
            </div>
        </li>

        <li class="aui-list-item" onclick="fnOpenWin1(this)" data-name="account_details">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title"><svg class="icon" aria-hidden="true">
<use xlink:href="#iconsk-mingxitiaozhang"></use>
</svg>账户明细</div>
                <div class="aui-list-item-right">
                    点击查看
                </div>
            </div>
        </li>
    </ul>
    <ul class="aui-list aui-list-in" style="margin:0.5rem 0;display:none;">
        <li class="aui-list-item" {{? it.name_status==null}} onclick="fnOpenWin(this)" {{?? it.name_status=="0" }} onclick="alert('审核中')" {{?? it.name_status=="1" }} onclick="alert('以认证')" {{?? it.name_status=="-1" }} onclick="fnOpenWin2(this)" {{?}} data-name="real_name">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" id="real-name" name_status="{{=it.name_status}}">实名认证</div>

                <div class="aui-list-item-right">
                    {{? it.name_status==null}} 点击认证 {{?? it.name_status=="0"}} 审核中 {{?? it.name_status=="1"}} 认证成功 {{?? it.name_status=="-1"}} 认证失败 {{?}}
                </div>


            </div>
        </li>
        <li class="aui-list-item" onclick="fnOpenWin1(this)" data-name="taobao_bind">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">淘号绑定</div>
                <div class="aui-list-item-right">
                    点击绑定
                </div>
            </div>
        </li>
        <li class="aui-list-item" onclick="fnOpenWin1(this)" data-name="jingdong_bind">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">京号绑定</div>
                <div class="aui-list-item-right">
                    点击绑定
                </div>
            </div>
        </li>
        <input type="hidden" id="nameReal" value="{{=it.name}}" />

        <li class="aui-list-item" onclick="fnOpenWin(this)" data-name="alipay_bind">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">支付宝绑定</div>
                <div class="aui-list-item-right">
                    点击绑定
                </div>
            </div>
        </li>
    </ul>
    <ul class="aui-list aui-list-in" style="margin:0.5rem 0;">
        <li class="aui-list-item" onclick="fnOpenWin1(this)" data-name="cash_voucher">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title"><svg class="icon" aria-hidden="true">
<use xlink:href="#iconsk-youhuiquan01"></use>
</svg>查看优惠券</div>
                <div class="aui-list-item-right">
                    点击查看
                </div>
            </div>
        </li>

    </ul>
    <ul class="aui-list aui-list-in" style="margin:0.5rem 0;">
        <li class="aui-list-item" onclick="fnOpenWinCommon(this)" data-url="my_msg">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title"><svg class="icon" aria-hidden="true">
<use xlink:href="#iconsk-xiaoxi"></use>
</svg>我的消息</div>
                <div class="aui-list-item-right">
                    点击查看
                </div>
            </div>
        </li>

    </ul>



</script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="./conf/config.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript">
    apiready = function() {
      //fnGetDataCommon(template_,url_,method_,data_,userinfo_=1)
      fnGetDataCommon("PersonCenter","index.php?m=api&c=appnew&a=get_userinfo","get");

        //fnGetUserInfo(); //获取用户信息分配到模板
      initRefreshCommon('fnGetDataCommon("PersonCenter","index.php?m=api&c=appnew&a=get_userinfo","get")');
        //fnGetUserInfo(); //获取用户信息分配到模板
      //  initRefresh(); //下拉
    };
    function PersonCenterRes(ret){
        //var dataInter = {"name":"Jake","age":31};
        var interText = doT.template($("#interpolationtmpl").text());
        $("#interpolation").html(interText(ret));

    }
    // function fnGetUserInfo() {
    //
    //     var userInfo = $api.getStorage('userInfo');
    //     if (typeof(userInfo) == "undefined") {
    //         api.openWin({
    //             name: "login",
    //             url: "login.html",
    //             opaque: true,
    //             vScrollBarEnabled: false
    //         });
    //         return false;
    //
    //     }
    //     //获取数据app中存入的数据然后分配到模板中；
    //     var random = userInfo.random;
    //     var userid = userInfo.userid;
    //
    //     api.ajax({
    //         url: SITE_URL + 'index.php?m=api&c=appnew&a=get_userinfo&random=' + random + '&userid=' + userid,
    //         method: 'get',
    //     }, function(ret, err) {
    //         //alert(JSON.stringify(ret));
    //         switch (ret.status) {
    //             case 0:
    //                 alert(ret.msg);
    //                 api.refreshHeaderLoadDone(); //下拉刷新隐藏
    //                 break;
    //             case '1':
    //                 //alert(111);
    //                 fnUpdatePersonCenter(ret);
    //                 api.refreshHeaderLoadDone(); //下拉刷新隐藏
    //                 break;
    //             case 2:
    //
    //                 //alert(ret.msg);
    //                 api.openWin({
    //                     name: 'login',
    //                     url: './login.html',
    //                     pageParam: {
    //                         name: 'test'
    //                     }
    //                 });
    //
    //                 //然后关闭当前网页，跳转到另一个网页；
    //                 break;
    //             case 5:
    //
    //                 api.refreshHeaderLoadDone(); //下拉刷新隐藏
    //                 break;
    //         }
    //
    //
    //         // if (ret.status == 1) {
    //         //
    //         //     //把数据分配到模板
    //         //     fnUpdatePersonCenter(ret);
    //         //     api.refreshHeaderLoadDone(); //下拉刷新隐藏
    //         // } else {
    //         //   //alert(2222);
    //         //     api.openWin({
    //         //         name: "login",
    //         //         url: "login.html",
    //         //         opaque: true,
    //         //         vScrollBarEnabled: false
    //         //     });
    //         //
    //         // }
    //     });
    // }

    // function fnUpdatePersonCenter(data) {
    //
    //     var interText = doT.template($("#interpolationtmpl").text());
    //     $("#interpolation").html(interText(data));
    //
    // }

    // function fnLoginOut() {
    //     api.confirm({
    //         title: '提示：',
    //         msg: '您确定退出？',
    //         buttons: ['确定', '取消']
    //     }, function(ret, err) {
    //         var index = ret.buttonIndex;
    //         if (index == 1) {
    //             $api.clearStorage();
    //             api.openWin({
    //                 name: 'main',
    //                 url: './main.html',
    //                 opaque: true,
    //                 cScrollBarEnabled: false,
    //                 reload: true,
    //
    //             });
    //         }
    //     });
    //
    //     //openwin 带上reload:true
    // }
    //所有试用
    function fnOpenWin2(that) {
        alert("重新认证！");

        api.openWin({
                name: "re_real_name",
                url: './re_real_name.html',
                opaque: true,
                cScrollBarEnabled: false,

            })
            // var name = $(that).attr("data-name");
            // api.openWin({
            //     name: name,
            //     url: './' + name + '.html',
            //     opaque: true,
            //     cScrollBarEnabled: false,
            // })
    }

    function fnOpenWin1(that) {
        var name = $(that).attr("data-name");
        api.openWin({
            name: name,
            url: './' + name + '.html',
            opaque: true,
            cScrollBarEnabled: false,
        })
    }

    function fnOpenWin(that) {
        var nameStatus = $("#real-name").attr("name_status");

        switch (nameStatus) {
            case 'null':
                alert("请进行实名认证！")
                var name = "real_name";
                break;
            case '1':
                var name = $(that).attr("data-name");
                break;
            case '-1':
                var msg = "实名认证失败，请重新进行认证！";

                break;
            case '0':
                var msg = "实名认证正在审核中，请耐心等待！";

                break;
            default:

        }
        if (msg) {
            alert(msg);
        }

        // var name = $(that).attr("data-name");
        //         if (name == "alipay_bind") {
        //             //访问实名认证接口
        //             var userInfo = $api.getStorage('userInfo');
        //             var name_status = userInfo.name_status;
        //             var is_real_name = name_status;
        //             if (is_real_name == "NULL") {
        //                 var name = 'real_name';
        //             } else if (is_real_name == '0') {
        //                 alert("等待实名认证审核结果");
        //                 return false;
        //             } else if (is_real_name == '-1') {
        //                 alert("实名认证失败");
        //                 return false;
        //             }
        //
        //         }
        if (name == "alipay_bind") {

            var userInfo = $api.getStorage("userInfo");
            var userid = userInfo.userid;
            var random = userInfo.random;

            api.ajax({
                url: SITE_URL + 'index.php?m=api&c=appnew&a=cash_account_info',
                method: 'post',
                data: {
                    values: {
                        "userid": userid,
                        "random": random,
                    }
                }
            }, function(ret, err) {
                if (ret.status == 5) {

                    api.openWin({
                        name: "alipay_bind",
                        url: './alipay_bind.html',
                        opaque: true,
                        cScrollBarEnabled: false,
                    });

                } else if (ret.status == 1) {
                    var realName5 = $("#nameReal").val();
                    //alert(realName5);
                    api.openWin({
                        name: "list_alipay_bind",
                        url: './list_alipay_bind.html',
                        pageParam: {
                            realName: realName5
                        },
                        opaque: true,
                        cScrollBarEnabled: false,
                    });
                }

            });


        } else {
            api.openWin({
                name: name,
                url: './' + name + '.html',
                opaque: true,
                cScrollBarEnabled: false,
            })

        }




    }
    //下拉刷新
    function initRefresh() {
        api.setRefreshHeaderInfo({
            visible: true,
            loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function(ret, err) {
            fnGetUserInfo();
        });
    }
</script>

</html>
